<template>
  <view class="list">
    <view
      class="item"
      v-for="item of items"
      :key="item.id"
      @click="Emit.$emit('handle', 'goItem', item)"
    >
      <pageHead :item="item"></pageHead>
      <pageGoodItem
        v-if="item.goods_list.length === 1"
        :item="item.goods_list[0]"
      ></pageGoodItem>
      <pageGoodsItem v-else :item="item"></pageGoodsItem>
      <pageBtn :item="item"></pageBtn>
    </view>
  </view>
</template>

<script>
import pageGoodItem from "./page-good-item.vue";
import pageGoodsItem from "./page-goods-item.vue";
import pageBtn from "./page-btn.vue";
import pageHead from "./page-head.vue";

export default {
  components: {
    pageGoodItem,
    pageGoodsItem,
    pageBtn,
    pageHead,
  },
  props: {
    items: {
      type: Array,
      default() {
        return [];
      },
    },
  },

  methods: {},
};
</script>

<style lang="less" scoped>
.list {
  padding: 24rpx 0;

  .item {
    margin-bottom: 24rpx;
    padding: 24rpx;
    background: #fff;
  }
}
</style>
